#include "Logger.hpp"
#include <string>

void test_default_logger() {
    INFO("This is a test message from the default logger.");
    DEBUG("Some debug info: value = %d", 100);
    WARN("A warning message with a string: %s", "hello world");
}

void test_custom_logger() {
    // 1. Build a new logger using the global builder
    senlog::GlobalLoggerBuilder builder;
    builder.buildLoggerName("my_async_logger_unsafe")
        //    .buildEnableUnsafe()
           .buildLoggerType(senlog::LoggerType::ASYNC_LOGGER)
           .buildLimitValue(senlog::LogLevel::value::DEBUG)
           .addSink<senlog::FileLogSink>("./logs/async_test.log")
           .addSink<senlog::StdoutLogSink>();
    
    // The logger is automatically added to the manager
    auto logger = builder.build();

    // 2. Use the custom logger
    LOG_INFO(logger, "This is a message from the custom async logger.");
    LOG_ERROR(logger, "Error code: %d, message: %s", 404, "Not Found");
}

int main() {
    std::cout << "--- Testing Default Logger ---" << std::endl;
    test_default_logger();

    std::cout << "\n--- Testing Custom Logger ---" << std::endl;
    test_custom_logger();

    // Give some time for the async logger to flush
    std::this_thread::sleep_for(std::chrono::seconds(1));

    return 0;
}